import { createRouter, createWebHistory } from 'vue-router'
import Layout from '../layout/Layout.vue'
const routes = [
  {
    path: "/:catchAll(.*)", // 不识别的path自动匹配404
    redirect: '/404',
  },
  {
    path: '/login',
    name: 'login',
    component:()=>import('@/views/Login.vue')
  },
  {
    path: '/',
    name: 'layout',
    redirect:"/CommontChat",
    component: Layout,
    children:[
      {
        path: 'CommontChat',
        name: 'CommontChat',
        component:()=>import('@/views/CommonChat.vue')
      },
      {
        path: 'TestChat',
        name: 'TestChat',
        component:()=>import('@/views/TestChat.vue')
      },
      {
        path: 'Test2.0',
        name: 'test2.0',
        component:()=>import('@/views/test2.0.vue')
      },
      {
        path: 'KBsChat',
        name: 'KBsChat',
        component:()=>import('@/views/KBsChat.vue')
      }
    ]
  },
  {
    path: '/test',
    name: 'test',
    component:()=>import('@/views/test.vue')
  },
  {
    path: '/register',
    name: 'register',
    component:()=>import('@/views/Register.vue')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
